<template>
    <div class="container" @click="handleGallaryClick">
<div class="swiper-container wrapper">
            <div class="swiper-wrapper">
                <div class="swiper-slide" v-for="item of imgs" :key="item.id">
                    <img class="swiper-img" :src='item'>
                </div>
            </div>
            <div class="swiper-pagination"></div>
        </div>
    </div>
        
</template>

<script>
import Swiper from 'swiper/js/swiper.min.js'
import 'swiper/css/swiper.min.css'
export default {
    
    name: 'Gallary',
    props: {
        imgs: Array
    },
    methods: {
        handleGallaryClick(){
            this.$emit('close')
        }
    }
    ,
    mounted() {
        new Swiper('.swiper-container', {

            loop: true, // 循环模式选项
            observer: true,
            observeParents: true,
            pagination: {
                el: '.swiper-pagination',
                type: 'fraction'
            }



        })
    }

}
</script>

<style lang="stylus" scoped>
    .container
        display flex
        flex-direction column
        justify-content center
        z-index 99
        position fixed
        left 0
        right 0
        top 0 
        bottom 0
        background #000
        .wrapper
            overflow inherit
            height 0
            width 100%
            padding-bottom 100%
            .swiper-img
                width 100%
        .swiper-pagination
            color #fff
            bottom -1rem
            
</style>